package com.ui;

import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.SWT;

import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.DateTime;

/**
* @ClassName: AddPassenger
* @Description: TODO
* @author alterhu2020@gmail.com
* @date Feb 16, 2014 11:19:22 AM
* 
*/

public class AddPassenger extends Dialog {

	protected Object result;
	protected Shell shell_addpassenger;
	private Text text_passenger_name;
	private Label lblNewLabel_name_note;
	private Label lblNewLabel_passenger_sex;
	private Button button_male;
	private Button button_female;
	private Label label_passenger_birth;
	private Button btnNewButton_passenger_cancel;
	private Button button_passenger_save;
	private DateTime dateTime_birthday;

	/**
	 * Create the dialog.
	 * @param parent
	 * @param style
	 */
	public AddPassenger(Shell parent) {
		super(parent, SWT.DIALOG_TRIM |SWT.CENTER| SWT.APPLICATION_MODAL);
		setText("SWT Dialog");
	}

	/**
	 * Open the dialog.
	 * @return the result
	 */
	public Object open() {
		createContents();
		shell_addpassenger.open();
		shell_addpassenger.layout();
		Display display = getParent().getDisplay();
		while (!shell_addpassenger.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		return result;
	}

	/**
	 * Create contents of the dialog.
	 */
	private void createContents() {
		shell_addpassenger = new Shell(getParent(), getStyle());
		shell_addpassenger.setSize(640, 506);
		shell_addpassenger.setText("\u6DFB\u52A0\u65C5\u5BA2");
		shell_addpassenger.setLayout(new RowLayout(SWT.HORIZONTAL));
		
		Group group_addpassenger = new Group(shell_addpassenger, SWT.NONE);
		group_addpassenger.setLayoutData(new RowData(644, 469));
		group_addpassenger.setText("\u65B0\u65C5\u5BA2\u4FE1\u606F");
		group_addpassenger.setLayout(new GridLayout(7, false));
		
		Label label = new Label(group_addpassenger, SWT.NONE);
		GridData gd_label = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
		gd_label.widthHint = 52;
		label.setLayoutData(gd_label);
		label.setText("*\u59D3\u540D");
		new Label(group_addpassenger, SWT.NONE);
		
		text_passenger_name = new Text(group_addpassenger, SWT.BORDER);
		GridData gd_text_passenger_name = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gd_text_passenger_name.widthHint = 127;
		text_passenger_name.setLayoutData(gd_text_passenger_name);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		
		lblNewLabel_name_note = new Label(group_addpassenger, SWT.NONE);
		lblNewLabel_name_note.setText("\u8BF7\u586B\u5165\u771F\u5B9E\u59D3\u540D\uFF0C\u4EE5\u4FBF\u8D2D\u4E70\u8F66\u7968\uFF08\u751F\u50FB\u5B57\u8BF7\u7528\u5C0F\u5199\u62FC\u97F3\uFF09");
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		
		lblNewLabel_passenger_sex = new Label(group_addpassenger, SWT.NONE);
		lblNewLabel_passenger_sex.setText("*\u6027\u522B");
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		
		button_male = new Button(group_addpassenger, SWT.RADIO);
		GridData gd_button_male = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gd_button_male.widthHint = 116;
		button_male.setLayoutData(gd_button_male);
		button_male.setGrayed(true);
		button_male.setSelection(true);
		button_male.setText("\u7537");
		
		button_female = new Button(group_addpassenger, SWT.RADIO);
		button_female.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
		button_female.setText("\u5973");
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		
		label_passenger_birth = new Label(group_addpassenger, SWT.NONE);
		label_passenger_birth.setText("\u51FA\u751F\u65E5\u671F");
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		
		dateTime_birthday = new DateTime(group_addpassenger, SWT.BORDER);
		GridData gd_dateTime_birthday = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gd_dateTime_birthday.widthHint = 139;
		dateTime_birthday.setLayoutData(gd_dateTime_birthday);
		System.out.println("birthday is:"+dateTime_birthday.getYear());
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		
		btnNewButton_passenger_cancel = new Button(group_addpassenger, SWT.NONE);
		GridData gd_btnNewButton_passenger_cancel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gd_btnNewButton_passenger_cancel.widthHint = 98;
		btnNewButton_passenger_cancel.setLayoutData(gd_btnNewButton_passenger_cancel);
		btnNewButton_passenger_cancel.setText("\u53D6\u6D88");
		new Label(group_addpassenger, SWT.NONE);
		new Label(group_addpassenger, SWT.NONE);
		
		button_passenger_save = new Button(group_addpassenger, SWT.NONE);
		GridData gd_button_passenger_save = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
		gd_button_passenger_save.widthHint = 89;
		button_passenger_save.setLayoutData(gd_button_passenger_save);
		button_passenger_save.setText("\u4FDD\u5B58");

	}
}
